package com.nbsaas.boot.express.rest.convert;

import com.nbsaas.boot.express.data.entity.Express;
import com.nbsaas.boot.express.api.domain.response.ExpressResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
import java.util.HashMap;
import java.util.Map;
/**
* 快递公司-实体对象转化成响应对象
*/

public class ExpressResponseConvert  implements Converter<ExpressResponse,Express> {

    @Override
    public ExpressResponse convert(Express source) {
        ExpressResponse  result = new  ExpressResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getEnabled()!=null){
                    Map<Integer,String> EnabledMap=new HashMap<>();
                        EnabledMap.put(1,"启用");
                        EnabledMap.put(2,"禁用");
                    String label=  EnabledMap.get(source.getEnabled());
                    result.setEnabledName(label);
                    }
                    result.setEnabled(source.getEnabled());
        return result;
    }

}

